]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overviewControls: Use ClutterActor's translation-x
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 23 Jan 2020 07:36:39 +0000 (15:36 +0800)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 28 Jan 2020 18:09:49 +0000 (18:09 +0000)
Instead of reimplementing `translation-x` as a relayout. It still looks
the same but no longer incurs relayouts during the animation which
reduces render time significantly.

Related to: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1271

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/948

js/ui/overviewControls.js

index 2b5cf9db59061a1dea74c05d95706281aec753fd..36014394577b5c08481f9f760ffd7974b710239c 100644 (file)
@@ -31,15 +31,10 @@ var SlideLayout = GObject.registerClass({
             'slide-x', 'slide-x', 'slide-x',
             GObject.ParamFlags.READWRITE,
             0, 1, 1),
-        'translation-x': GObject.ParamSpec.double(
-            'translation-x', 'translation-x', 'translation-x',
-            GObject.ParamFlags.READWRITE,
-            -Infinity, Infinity, 0),
     },
 }, class SlideLayout extends Clutter.FixedLayout {
     _init(params) {
         this._slideX = 1;
-        this._translationX = 0;
         this._direction = SlideDirection.LEFT;
 
         super._init(params);
@@ -72,7 +67,7 @@ var SlideLayout = GObject.registerClass({
             : availWidth - natWidth * this._slideX;
 
         let actorBox = new Clutter.ActorBox();
-        actorBox.x1 = box.x1 + alignX + this._translationX;
+        actorBox.x1 = box.x1 + alignX;
         actorBox.x2 = actorBox.x1 + (child.x_expand ? availWidth : natWidth);
         actorBox.y1 = box.y1;
         actorBox.y2 = actorBox.y1 + availHeight;
@@ -102,20 +97,6 @@ var SlideLayout = GObject.registerClass({
     get slideDirection() {
         return this._direction;
     }
-
-    // eslint-disable-next-line camelcase
-    set translation_x(value) {
-        if (this._translationX == value)
-            return;
-        this._translationX = value;
-        this.notify('translation-x');
-        this.layout_changed();
-    }
-
-    // eslint-disable-next-line camelcase
-    get translation_x() {
-        return this._translationX;
-    }
 });
 
 var SlidingControl = GObject.registerClass(
@@ -184,11 +165,12 @@ class SlidingControl extends St.Widget {
         else
             translationEnd = translation;
 
-        if (this.layout.translation_x == translationEnd)
+        if (this.translation_x === translationEnd)
             return;
 
-        this.layout.translation_x = translationStart;
-        this.ease_property('@layout.translation-x', translationEnd, {
+        this.translation_x = translationStart;
+        this.ease({
+            translation_x: translationEnd,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             duration: SIDE_CONTROLS_ANIMATION_TIME,
         });